home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 028a / managr02.zip / AUTOEXEC.BAS next >
BASIC Source File  |  1991-12-09  |  5KB  |  243 lines

  1. chngauto:
  2. cls
  3. print "                     View or Change Your AUTOEXEC.BAT File
  4. print
  5. print
  6. input "On which drive is your AUTOEXEC.BAT file";drive$
  7. redrivea:
  8. drive$=drive$+"\"
  9. if drive$="a:\" then file1$="a:\autoexec.bat"
  10. if drive$="A:\" then file1$="a:\autoexec.bat"
  11. if drive$="b:\" then file1$="b:\autoexec.bat"
  12. if drive$="B:\" then file1$="b:\autoexec.bat"
  13. if drive$="c:\" then file1$="c:\autoexec.bat"
  14. if drive$="C:\" then file1$="c:\autoexec.bat"
  15. if drive$="d:\" then file1$="d:\autoexec.bat"
  16. if drive$="D:\" then file1$="d:\autoexec.bat"
  17. if drive$="e:\" then file1$="e:\autoexec.bat"
  18. if drive$="E:\" then file1$="e:\autoexec.bat"
  19.  
  20. if drive$="a:\" then file2$="a:\autoexec.bak"
  21. if drive$="A:\" then file2$="a:\autoexec.bak"
  22. if drive$="b:\" then file2$="b:\autoexec.bak"
  23. if drive$="B:\" then file2$="B:\autoexec.bak"
  24. if drive$="c:\" then file2$="c:\autoexec.bak"
  25. if drive$="C:\" then file2$="c:\autoexec.bak"
  26. if drive$="d:\" then file2$="d:\autoexec.bak"
  27. if drive$="D:\" then file2$="d:\autoexec.bak"
  28. if drive$="e:\" then file2$="e:\autoexec.bak"
  29. if drive$="E:\" then file2$="e:\autoexec.bak"
  30.  
  31. automenu:
  32. cls
  33. print "You have the following options:"
  34. print
  35. print
  36. print "1- Just view the AUTOEXEC.BAT file."
  37. print
  38. print "2- Add lines to the end of your file."
  39. print
  40. print "3- Create a new AUTOEXEC.BAT file."
  41. print
  42. print "4- Return to the Main Options Menu.
  43. print
  44. print
  45. print
  46. input "Please press the number corresponding to your choice, and then press Enter. ",chngauto$
  47.  
  48. if chngauto$="1" then
  49. cls
  50. gosub autolook
  51. goto automenu
  52. elseif chngauto$="2" then
  53. cls
  54. gosub appndaut
  55. gosub autolook
  56. goto automenu
  57. elseif chngauto$="3" then
  58. cls
  59. goto newauto
  60. elseif chngauto$="4" then
  61. cls
  62. goto finish
  63. else
  64. goto automenu
  65. end if
  66.  
  67.  
  68. ' This routine creates a new AUTOEXEC.BAT file.
  69.  
  70. newauto:
  71. cls
  72. open file1$ for input as 1
  73. open file2$ for output as 2
  74. while not eof(1)
  75. line input # 1, a$
  76. print # 2, a$
  77. wend
  78. close # 1
  79. close # 2
  80. kill file1$
  81. cls
  82. print "Your AUTOEXEC.BAT file has been changed to AUTOEXEC.BAK in order to
  83. print "save it for later use.  To use it later, you will have to
  84. print "rename it AUTOEXEC.BAT after renaming the current AUTOEXEC.BAT to
  85. print "something else (for example, AUTOEXEC.X)."
  86. print
  87. print
  88. print "Press any key to continue. ";
  89. gosub presskey
  90.  
  91. scndchng:
  92. cls
  93. open file1$ for output as 1
  94. print "Please type the first line you want, then press Enter (Q to quit).
  95. print
  96. input "> ",firstln$
  97.  
  98. if firstln$="q" then
  99. goto nochange
  100. elseif firstln$="Q" then
  101. goto nochange
  102. end if
  103.  
  104. print # 1, firstln$
  105.  
  106. contline:
  107. print
  108. print "Please type your next line, followed by Enter (Q to quit).
  109. print
  110. input "> ",nextline$
  111.  
  112. if nextline$="q" then
  113. goto stopchng
  114. elseif nextline$="Q" then
  115. goto stopchng
  116. end if
  117.  
  118. print # 1, nextline$
  119. goto contline
  120.  
  121. stopchng:
  122. close # 1
  123. cls
  124. gosub autolook
  125. print
  126. print
  127. print
  128. print "If this is not O.K. AND you want to change it, press C and then Enter."
  129. print
  130. print "To restore your original AUTOEXEC.BAT, press R and then Enter.
  131. print
  132. input "If you're happy with it as is, type OK and Enter. ",changeyn$
  133.  
  134. rechange:
  135. if changeyn$="c" then
  136. goto scndchng
  137. elseif changeyn$="C" then
  138. goto scndchng
  139. elseif changeyn$="r" then
  140. goto nochange
  141. elseif changeyn$="R" then
  142. goto nochange
  143. elseif changeyn$="ok" then
  144. goto automenu
  145. elseif changeyn$="OK" then
  146. goto automenu
  147. elseif changeyn$="oK" then
  148. goto automenu
  149. elseif changeyn$="Ok" then
  150. goto automenu
  151. end if
  152.  
  153. print
  154. input "You must choose C, R, or OK. ",changeyn$
  155. goto rechange
  156.  
  157. nochange:
  158. cls
  159. reset
  160. kill file1$
  161. open file2$ for input as 1
  162. open file1$ for output as 2
  163.  
  164. while not eof(1)
  165. line input # 1, a$
  166. print # 2, a$
  167. wend
  168.  
  169. reset
  170. print "Your original AUTOEXEC.BAT file has been restored.
  171. print
  172. print
  173. print "Press any key to continue. ";
  174. gosub presskey
  175. goto automenu
  176.  
  177. ' This is the end of the routine for working with the AUTOEXEC.BAT file.
  178.  
  179.  
  180. ' Here is the routine for looking at the AUTOEXEC.BAT file.
  181.  
  182. autolook:
  183. cls
  184. reset
  185. print "Here is your file:"
  186. print
  187. print
  188. open file1$ for input as 1
  189.  
  190. while not eof(1)
  191. line input # 1, a$
  192. print a$
  193. wend
  194.  
  195. close # 1
  196. print
  197. print
  198. print "Press any key to continue. ";
  199. gosub presskey
  200. return
  201.  
  202. ' This is the end of the routine for looking at the AUTOEXEC.BAT file.
  203.  
  204.  
  205. ' Here is the routine for adding lines to the end of AUTOEXEC.BAT.
  206.  
  207. appndaut:
  208. cls
  209. reset
  210. open file1$ for append as 1
  211.  
  212. appndagn:
  213. print
  214. input "Line to add (Q to quit)";appendln$
  215.  
  216. if appendln$="q" then
  217. close # 1
  218. return
  219. elseif appendln$="Q" then
  220. close # 1
  221. return
  222. end if
  223.  
  224. print # 1, appendln$
  225. goto appndagn
  226.  
  227. ' This is the end of the routine for adding to the end of AUTOEXEC.BAT.
  228.  
  229.  
  230. 'Here is the routine for continuing when the user presses a key.
  231.  
  232. presskey:
  233. wait:
  234. a$=inkey$
  235. if a$="" then goto wait
  236. return
  237.  
  238.  
  239. 'Here is the routine for ending the program.
  240.  
  241. finish:
  242. end
  243.